package com.ciban.smarthome.module;

import com.ciban.smarthome.common.utils.logcrash.CrashHandler;
import com.ciban.smarthome.common.utils.logcrash.CrashHandler.CrashListener;
import com.ciban.smarthome.module.entity.Area;
import com.videogo.constant.Config;
import com.videogo.openapi.EzvizAPI;

import android.app.Application;
import android.content.Context;

public class BaseApplication extends Application {
	public static String APP_KEY ="c1d4398bb8d5446980f65aa475783d88";
	public static String API_URL = "https://open.ys7.com";
	public static String WEB_URL = "https://auth.ys7.com";

	private Area nowArea; //当前操作的区域

	@Override
	public void onCreate() {
		super.onCreate();
//		initCrashHandler();
		initHkCamera();
	}

	/**
	 * 初始化海康摄像头的配置
	 */
	private void initHkCamera() {
		Config.LOGGING = true;
		EzvizAPI.init(this, APP_KEY);
		//EzvizAPI.init(this, APP_KEY, "/mnt/sdcard/VideoGo/libs/");
		EzvizAPI.getInstance().setServerUrl(API_URL, WEB_URL);
		//EzvizAPI.getInstance().setAccessToken("at.dmtlxyp47nejsckiai1pdwzsdvxmo7jp-8ofxo9vacz-1s48ov1-p3r36v0vj");
		//EzvizAPI.getInstance().setUserCode("71cd711da693b315");
	}

	private void initCrashHandler() {
		CrashHandler crashHandler = CrashHandler.getInstance(this);
		crashHandler.init();
		crashHandler.setListener(new CrashListener() {

			@Override
			public void crashIng(Context context) {

			}

			@Override
			public void collectCrashLog(String log) {

			}
		});
	}

	public Area getNowArea() {
		return nowArea;
	}

	public void setNowArea(Area nowArea) {
		this.nowArea = nowArea;
	}




	
}
